import React, { Component } from 'react'
import Son from './Son'
import context from './context'
export default class Far extends Component {
  //   接收context数据的组件,添加静态属性contextType,contextType的值就是context对象
  static contextType = context

  // 如果添加了contextType静态属性,则当前组件实例上的context属性的值就是App中传递的数据
  render() {
    return (
      <div>
        Far, {this.context}
        <hr />
        <Son></Son>
      </div>
    )
  }
}
